<%--
  Created by IntelliJ IDEA.
  User: Zhao
  Date: 2017/2/21
  Time: 23:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建模块</title>
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    $(function () {
        $('.module-create-submit').bind('click',function () {
            var id = $('.create-module-table [name="id"]').val();
            var name = $('.create-module-table [name="name"]').val();
            var type = $('.create-module-table [name="type"]').val();
            $.ajax({
                url:'/admin/module/createModule.do',
                type:'POST',
                //将formData对象作为参数进行上传
                data:{
                    'id':id,
                    'name':name,
                    'type':type,
                },
                success:function (data) {
                    if(data=='success'){
                        $.messager.alert('成功','模块添加成功');
                        $('#moduleDg').datagrid('reload');
                        return ;
                    }
                    $.messager.alert('警告','模块添加失败');
                },
                error:function () {
                    $.messager.alert('警告','模块添加失败');
                }
            })
        })
    })


</script>
<b>模块id为1的模块将推送到首页中上方,id为2的模块将被推送到首页中下方,<br/>id为3的模块将被推送到模块左侧，其他模块不需要指定id</b>
<hr/>
<table class="table create-module-table">
    <tr>
        <td>模块ID</td>
        <td><input type="number" name="id"></td>
    </tr>
    <tr>
        <td>模块名称</td>
        <td><input type="text" name="name"></td>
    </tr>
    <tr>
        <td>模块类型</td>
        <td>
            <select name="type" >
                <option value ="0" selected="true">普通类型</option>
                <option value ="1">人物类型</option>
            </select>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <a class="easyui-linkbutton module-create-submit" data-options="iconCls:'icon-ok'"  >提交</a>
        </td>
    </tr>
</table>
</body>
</html>